#ifndef CLIENTTHREAD_H
#define CLIENTTHREAD_H

#include <QThread>
#include <QTcpSocket>
#include <QFile>
#include <QFileInfo>
class ClientThread : public QThread
{
    Q_OBJECT
public:
    explicit ClientThread(ushort port,QString ip,QString filePath,QObject *parent = nullptr);
    void disConnectTcp();
protected:
    virtual void run();
signals:
    void sigFileInfo(QString ,qint64 );
    void sigOver(QString,bool);

public slots:
    void dealDisconnect();
    void dealConnect();
    void dealRead();
private:
    QString m_ip;
    ushort m_port;
    QTcpSocket* m_tcpSocket;

    QFile m_file;
    qint64 m_fileSize;
    qint64 m_sendSize;
    QString m_filePath;
    QString m_fileName;
    bool m_stop;
    bool m_sendOk;
    QString m_time;
    QString m_fileNameTime;
private:
    void sendHead();
    void sendFile();
};

#endif // CLIENTTHREAD_H
